package com.kim.openfeign.feign.impl;

import com.codingapi.txlcn.tc.support.DTXUserControls;
import com.codingapi.txlcn.tracing.TracingContext;
import com.kim.common.resp.CodeMsg;
import com.kim.common.resp.Result;
import com.kim.openfeign.feign.UserFeign;
import com.kim.user.common.entity.SysUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author KimWu
 * @date 2020/6/3 10:45
 * @Description ：
 */
@Component
@Slf4j
public class UserFeignImpl implements UserFeign {
    @Override
    public Result<SysUser> findByUsername(String username) {
        log.info("findByUsername Feign调用失败，事务回滚！");
        DTXUserControls.rollbackGroup(TracingContext.tracing().groupId());
        return Result.error(CodeMsg.TX_LCN_BACK);
    }

    @Override
    public Result<String> userInsert(String userName) {
        log.info("userInsert Feign调用失败，事务回滚！");
        DTXUserControls.rollbackGroup(TracingContext.tracing().groupId());
        return Result.error(CodeMsg.TX_LCN_BACK);
    }

    @Override
    public Result<String> roleInsert(String roleName) {
        log.info("roleInsert Feign调用失败，事务回滚！");
        DTXUserControls.rollbackGroup(TracingContext.tracing().groupId());
        return Result.error(CodeMsg.TX_LCN_BACK);
    }
}
